<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.wabson.alfresco.translations.bean.JarListLoader"%>
<%@page import="org.wabson.alfresco.translations.bean.Jarfile"%>
<%@page import="java.util.List"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.NumberFormat"%>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.ArrayList" %>
<%@page import="java.util.Collections"%>
<%@ page import="org.wabson.alfresco.translations.BlobInfoDateComparator" %>
<%
	WebApplicationContext springContext = WebApplicationContextUtils
		.getRequiredWebApplicationContext(getServletContext());
	
	List<Jarfile> uploads = ((JarListLoader) springContext.getBean("jar-list-loader")).getJars();
%>
<html>
<head>
<title>All Uploads</title>
<link rel="stylesheet" type="text/css" href="/assets/screen.css" />
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-340797-7']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>
<body>
<div class="header">
<p class="title"><a href="/">Alfresco I18N Tools</a></p>
</div>

<div class="body">
<h1>All Uploads</h1>
<table>
<tr>
<th>Name</th>
<th>Size</th>
<th>Uploaded</th>
</tr>
<%
   for(Jarfile jar : (uploads.size() > 5 ? uploads.subList(0, 5) : uploads))
   {
%>
<tr>
<td><a href="/details?k=<%= jar.getId() %>"><%= jar.getName() %></a></td>
<td><%= NumberFormat.getInstance().format(jar.getSize() / 1024) %>kB</td>
<td><%= DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(jar.getCreationDate()) %></td>
</tr>
<%
   }
%>
</table>
</div>
</body>
</html>